<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
           *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            textarea{
                width: 500px;
                margin:0px auto;
                display: block;
                resize: none;
                outline: none;
            }
            button{
                width: 500px;
                margin:20px auto;
                display: block;
                border:none;
                background:blue;
                line-height: 20px;
                cursor: pointer;
                color:red;
                outline: none;
            }
            ul{
                width: 500px;
                margin:10px auto;
            }
            li{
                border:1px solid pink;
                padding:20px;
                position: relative;
            }
            span{
                position: absolute;
                right:10px;
                top:10px;
                cursor: pointer;
            }
    </style>
</head>
<body>
        <textarea name="" id="txt" cols="30" rows="10"></textarea>
        <button id="bag">发布微博</button>
        <ul id="box">
            <li>
                困困困困困困困
                <p>2021-06-05</p>
                <span onclick="del(this)">x</span>
            </li>
        </ul>
        <script>
            var txt=document.getElementById('txt');
            var btn=document.getElementById('bag');
            var box=document.getElementById('box');
            var year=new Date().getFullYear();
            var month=new Date().getMonth()+1;
            var date=new Date().getDate()
            btn.onclick=function(){
                var val=txt.value;
                var tag=document.createElement('li');
                tag.innerHTML=`${val}
                <p>${year}-${month}-${date}</p>
                <span onclick="del(this)">x</span>`;
                box.appendChild(tag)
            }
            function del(a){
                a.parentNode.parentNode.removeChild(a.parentNode)
            }
        </script>
</body>
</html>